FROM golang:1.20.4 as golang

ENV GO111MODULE=on \
    CGO_ENABLED=1 \
    GOPROXY=https://goproxy.cn,direct

WORKDIR /build
ADD . /build

RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-w -s' -o hourglass

FROM hub.atomgit.com/amd64/alpine:3.15.10
WORKDIR /app

# RUN apk add --no-cache bash
COPY --from=golang /build/hourglass /app
COPY ./config /app/config
ENTRYPOINT ["/app/hourglass"]